def main():
    y_or_n = input("是否退出程序（退出请输入yes，否则输入no）？")
    while (y_or_n != "yes"):
        print("请输入以下个人信息，用空格隔开")
        person_str = input("性别：体重（kg）：身高（cm）：年龄：")
        person = person_str.split("")
        try:
            gender = person[0]
            weight = float(person[1])
            height = float(person[2])
            age = int(person[3])

            if gender == "女":
                BMR = 661 + 9.6 * weight + 1.72 * height - 4.7 * age
            elif gender == "男":
                BMR = 67 + 13.73 * weight + 5 * height - 6.9 * age
            else:
                BMR = -1
            if BMR != -1:
                print("您的性别为{}，体重为{}kg，身高为{}cm，年龄为{}岁".format(gender, height, weight, age))
                print("您的基础代谢率为{}大卡".format(BMR))
            else:
                print("暂不支持该性别！")



        except ValueError:
            print("请输入正确的个人信息！")
        except IndexError:
            print("请输入完整的个人信息！")
        except:
            print("系统有误！")
        print()
        y_or_n = input("是否退出程序（退出请输入yes）？")


if __name__ == "__main__":
    main()

